FROM alpine:latest

MAINTAINER wang_sgang

RUN ver=`cat /etc/alpine-release` && mres="https://mirrors.aliyun.com/alpine/v${ver%.${ver#*.*.}}/main/" && cres="https://mirrors.aliyun.com/alpine/v${ver%.${ver#*.*.}}/community/" && cp /etc/apk/repositories /etc/apk/repositories.bak && echo -e $mres"\n"$cres> /etc/apk/repositories && apk update

RUN apk add gcc && apk add g++ && apk add gfortran && apk add freetype-dev && apk add libpng-dev && apk add python3 && mkdir ~/.pip && echo -e "[global]\nindex-url = https://mirrors.aliyun.com/pypi/simple/\n\n[install]\ntrusted-host=mirrors.aliyun.com">~/.pip/pip.conf && pip3 install --upgrade pip && apk add python3-dev && pip3 install numpy && apk add lapack-dev && apk add py3-psycopg2 && pip3 install scipy && pip3 install matplotlib && pip3 install scikit-learn && pip3 install pandas && pip3 install statsmodels && pip3 install jupyter && mkdir data && sed -i "s/#font.family/font.family/g" /usr/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc && sed -i "s/#font.sans-serif     :/font.sans-serif     : simhei,/g" /usr/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc && sed -i "s/#axes.unicode_minus  : True/axes.unicode_minus  : False/g" /usr/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc && pip3 install networkx

ADD simhei.ttf /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/simhei.ttf

EXPOSE 8888

CMD ["jupyter", "notebook","--allow-root","--ip=0.0.0.0","--port=8888"]

